package com.imooc.controller.center;

import com.imooc.pojo.Users;
import com.imooc.service.center.CenterUserService;
import com.imooc.utils.IMOOCJSONResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @ClassName: CenterController
 * @Package: com.imooc.controller.center
 * @Description:
 * @Date: 2021/7/22 10:55
 * @Author: sunzheng@beiming.com
 */
@Api(value = "center - 用户中心", tags = {"用户中心展示的相关接口"})
@RestController
@RequestMapping("/center")
public class CenterController {

  @Autowired
  private CenterUserService centerUserService;

  @ApiOperation(value = "获取用户信息", notes = "获取用户信息", httpMethod = "GET", produces = "application/json")
  @GetMapping("/userInfo")
  public IMOOCJSONResult userInfo(
      @ApiParam(name = "userId", value = "用户Id", required = true)
      @RequestParam(value = "userId") String userId) {

    Users user = centerUserService.queryUserInfo(userId);
    return IMOOCJSONResult.ok(user);

  }

}
